<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "sys_item_prices".
 *
 * @property integer $id
 * @property integer $item_id
 * @property integer $size_id
 * @property integer $fabric_id
 * @property integer $material_id
 * @property string $price_custom
 * @property string $price_discount
 * @property string $price_cost
 */
class SysItemPrices extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'sys_item_prices';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'item_id', 'size_id', 'fabric_id', 'material_id'], 'integer'],
            [['price_custom', 'price_discount','price_cost'], 'number'],
           // [['item_id', 'size_id', 'fabric_id','material_id'], 'unique', 'targetAttribute' => ['item_id', 'size_id', 'fabric_id','material_id'], 'message' => Yii::t('app','The combination of Item ID, Fid and Mid has already been taken.')]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'item_id' => 'Item ID',
            'size_id' => 'Size ID',
            'fabric_id' => 'Fabric ID',
            'material_id' => 'Material ID',
            'price_custom' => 'Price Custom',
            'price_discount' => 'Price Discount',
            'price_cost' => 'Price Cost',
        ];
    }
    public function getSize()
    {
    	return $this->hasOne(SysItemSize::className(),['id'=>'size_id']);
    }
    public function getItemFabric()
    {
    	return $this->hasOne(Fabric::className(),['id'=>'fabric_id']);
    }
    public function getItemMaterial()
    {
    	return $this->hasOne(Material::className(),['id'=>'material_id']);
    }
    
}
